package com.xy.job

import com.xy.job.admin.core.schedule.Scheduler
import java.time.LocalDateTime
import java.time.temporal.ChronoUnit
import kotlin.test.Test

class TimeWheelTests {

    @Test
    fun f() {
        val scheduler = Scheduler(
            slotTick = 1L,
            slotSize = 2000,
        )
        scheduler.addTask("task 3", -1L, ChronoUnit.SECONDS) { println("3 hello world") }
        scheduler.addTask("task 3", 1L, ChronoUnit.SECONDS) { println("3 hello world") }
        scheduler.addTask("task 6", 6L, ChronoUnit.SECONDS) { println("6 hello world") }
//        scheduler.start()
//        TimeUnit.SECONDS.sleep(8)
//        scheduler.stop()
    }

    @Test
    fun f2() {
        val now = LocalDateTime.now()
        val plusHours = now.plusMinutes(60)
        val until = now.until(plusHours, ChronoUnit.SECONDS)
        println(until)
    }
}